package ynu.sxp.demoapp.cart.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import ynu.sxp.demoapp.common.BaseEntity;
import ynu.sxp.demoapp.product.entity.ProductEntity;

import java.util.UUID;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Getter
@Setter
@Table(name = "cart_product")
public class CartProductEntity extends BaseEntity {

    private UUID cartId;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "product_id", nullable = false)
    private ProductEntity product;

    private Integer quantity = 0;
}
